from langchain.text_splitter import RecursiveCharacterTextSplitter

with open("./datafile/test.txt", encoding="utf-8") as f:
    zuizhonghuanxiang = f.read()

text_splitter = RecursiveCharacterTextSplitter(
    chunk_size=50,
    chunk_overlap=20,#切分的块重叠大小,
    length_function=len,
    add_start_index=True,#是否添加起始索引
)

text = text_splitter.create_documents([zuizhonghuanxiang])
print(len(text))
print(text[0])
print(text[1])
